/*
   Copyright (c) 2023 李伟国
   learner-platform is licensed under Mulan PSL v2.
   You can use this software according to the terms and conditions of the Mulan PSL v2.
   You may obtain a copy of Mulan PSL v2 at:
            http://license.coscl.org.cn/MulanPSL2
   THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
   See the Mulan PSL v2 for more details.
*/

package cn.platform.service;

import cn.platform.dto.CodeRunMsg;
import cn.platform.dto.CodeRunResult;
import cn.platform.dto.TestInOut;
import cn.platform.entity.Runner;

import java.util.List;

public interface IJudgeService {
    /**
     * 保存题目的测试样例，将题目的测试样例存在本地的某个文件夹中
     *
     * @return 操作是否成功
     */
    @Deprecated
    boolean saveTestCase();


    CodeRunResult runCode(Runner runner);

    @Deprecated
    String saveCode(String code, String filePrefix, String fileSuffix);

    /**
     * 保存测试用例
     *
     * @param problemId  题目id
     * @param testInOuts 输入输出列表
     * @return 是否保存成功
     */
    boolean saveTestCase(Integer problemId, List<TestInOut> testInOuts);

    /**
     * 保存题目中已经展示的测试样例
     *
     * @param problemId  题目id
     * @param testInOuts 输入输出列表
     * @return 是否保存成功
     */
    boolean saveTestSample(Integer problemId, List<TestInOut> testInOuts);

    /**
     * 向本地创建测试代码
     *
     * @param codeRunMsg 测试代码
     * @return 测试代码文件的路径
     */
    String saveTestCode(CodeRunMsg codeRunMsg);

    /**
     * 运行测试代码
     * @param runner 测试代码信息
     * @return 运行结果
     */
    CodeRunResult runTestCode(Runner runner);

    /**
     * 运行用户的代码
     * @param userId 用户id
     * @param runner 用户的代码信息
     * @return 运行结果
     */
    CodeRunResult runUserCode(Long userId, Runner runner);

}
